package ${package}.controller;

import com.njzxw.fs.commonutil.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import ${package}.server.${className}Server;
import ${package}.bean.${className}Bean;
import com.njzxw.fs.commonutil.bean.BaseBean;
import org.springframework.validation.BindingResult;
import com.njzxw.fs.commonutil.web.ReturnMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@RestController
@RequestMapping("${className_}")
public class ${className}Controller extends BaseController{

    @Autowired
    private ${className}Server ${className_}Server;

    /**
     * 分页获取数据
     */
    @RequestMapping("/queryPage")
    public ReturnMap queryPage(HttpServletRequest request, HttpServletResponse response,@RequestBody @Validated({${className}Bean.QueryPage.class, BaseBean.CheckAuthority.class}) ${className}Bean ${className_}Bean, BindingResult bindingResult) {
        return ${className_}Server.queryPage(request,response,${className_}Bean);
    }

    /**
     * 获取但一条数据信息
     */
    @RequestMapping("/queryId")
    public ReturnMap queryId(HttpServletRequest request, HttpServletResponse response,@RequestBody @Validated({${className}Bean.QueryId.class,BaseBean.CheckId.class, BaseBean.CheckAuthority.class}) ${className}Bean ${className_}Bean, BindingResult bindingResult) {
        return ${className_}Server.queryId(request,response,${className_}Bean);
    }

    /**
     * 修改某一条数据信息
     */
    @RequestMapping("/update")
    public ReturnMap update(HttpServletRequest request, HttpServletResponse response,@RequestBody @Validated({${className}Bean.Update.class,BaseBean.CheckId.class, BaseBean.CheckAuthority.class}) ${className}Bean ${className_}Bean, BindingResult bindingResult) {
        return ${className_}Server.update(request,response,${className_}Bean);
    }

    /**
     * 删除数据信息
     */
    @RequestMapping("/delete")
    public ReturnMap delete(HttpServletRequest request, HttpServletResponse response,@RequestBody @Validated({${className}Bean.Delete.class, BaseBean.CheckAuthority.class}) ${className}Bean ${className_}Bean, BindingResult bindingResult) {
        return ${className_}Server.delete(request,response,${className_}Bean);
    }

    /**
     * 插入数据信息
     */
    @RequestMapping("/insert")
    public ReturnMap insert(HttpServletRequest request, HttpServletResponse response,@RequestBody @Validated({${className}Bean.Insert.class, BaseBean.CheckAuthority.class}) ${className}Bean ${className_}Bean, BindingResult bindingResult) {
        return ${className_}Server.insert(request,response,${className_}Bean);
    }

    /**
     * 插入数据信息
     */
    @RequestMapping("/save")
    public ReturnMap save(HttpServletRequest request, HttpServletResponse response,@RequestBody @Validated({${className}Bean.Save.class, BaseBean.CheckAuthority.class}) ${className}Bean ${className_}Bean, BindingResult bindingResult) {
        return ${className_}Server.save(request,response,${className_}Bean);
    }

    /**
     * 导入方法
     * @param request
     * @param response
     */
    @RequestMapping("/import")
    public ReturnMap import${className}(HttpServletRequest request, HttpServletResponse response,@RequestBody  ${className}Bean ${className_}Bean){
        return ${className_}Server.import${className}(request,response,${className_}Bean);
    }

}